<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>电子优惠劵报表</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css" media="all">
	</head>

    <style>
    	.empty{
    		top: 2px;
    	}
    </style>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<!--右侧内容-->
					<div class="rigtop">
						<span class="title">电子优惠劵报表</span>
					</div>
					<div class="indrig_con">
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<form id="my_form" action="{:url('count/coupons')}" method="post">
								<div class="zizh_con_1">
									<div class="shxx_row chax_row clearfix">
										<div class="left" style="margin-left:35px">交易时间：</div>
										<div class="right clearfix">
											<div class="layui-inline">
												<div class="layui-input-inline">
													<input type="text" class="layui-input" name="begin_time" id="begin_time" value="{$begin_time}" placeholder="yyyy年MM月dd日">
												</div>
											</div>
											<i class="chax_line"></i>
											<div class="layui-inline">
												<div class="layui-input-inline">
													<input type="text" class="layui-input" name="end_time" id="end_time" value="{$end_time}" placeholder="yyyy年MM月dd日">
												</div>
											</div>
										</div>
										<div class="shxx_row chax_row clearfix">
								            <div class="left sczy">市场专员：</div>
								            <div class="right clearfix">
								                <input style="width: 170px;" type="text" name="pt1_id" id="pt1_id" value="{$pt1_id}" placeholder="市场专员id" class="chax_input" />
								          	 </div>
							      		 </div>
							      		<div class="shxx_row chax_row clearfix">
								            <div class="left sczy">会员ID：</div>
								            <div class="right clearfix">
								                <input style="width: 170px;" type="text" name="uid" id="uid" value="{$uid}" placeholder="会员ID" class="chax_input" />
								          	 </div>
							      		</div>
									</div>
									
									<div class="shxx_row clearfix">
										 <div class="left sczy">商家：</div>
							            <div class="right clearfix">
							                <input style="width: 170px;" type="text" name="agent_id" id="agent_id" value="{$agent_id}" placeholder="商家id" class="chax_input" />
							          	 </div>
							          	
							          	{if $Think.session.user_level==1 || $Think.session.user_level==4}
							          	 <div class="left" style="width: 100px;">区域运营商：</div>
								            <div class="right clearfix">
								                <input style="width: 170px;" type="text" name="ch_city" id="ch_city" value="{$ch_city}" placeholder="区域运营商id" class="chax_input" />
								          	 </div>
										{/if}

                                        {if $Think.session.user_level==2}
										<div class="shxx_row chax_row clearfix">
											<div class="left" style="width: 100px;">区域运营商：</div>
											<div class="right clearfix">
												<div id="htselect">
													<select name="ch_city" id="ch_city">
														<option value="">全部</option>
														{volist name="city" id="to"}
														<option value="{$to.id}" {if $to.id==$ch_city}selected{/if}>{$to.user_name}</option>
														{/volist}
													</select>
												</div>
											</div>
										</div>
										{/if}

										
								        {if $Think.session.user_level==1 || $Think.session.user_level==4}
										<div class="shxx_row chax_row clearfix">
											<div class="left" style="width: 100px;">市级代理商：</div>
											<div class="right clearfix">
												<div id="htselect">
													<select name="operator" id="operator">
														<option value="">全部</option>
														{volist name="agency" id="vo"}
														<option value="{$vo.id}" {if $vo.id==$agency_id1}selected{/if}>{$vo.user_name}</option>
														{/volist}
													</select>
												</div>
											</div>
										</div>
										{/if}
										{if $Think.session.user_level==1}
										<div class="shxx_row chax_row clearfix">
											<div class="left" style="width: 100px;">省级代理商：</div>
											<div class="right clearfix">
												<div id="htselect">
													<select name="province" id="province">
														<option value="">全部</option>
														{volist name="province" id="val"}
														<option value="{$val.id}" {if $val.id==$agency_id}selected{/if}>{$val.user_name}</option>
														{/volist}
													</select>
												</div>
											</div>
										</div>
										{/if}
										<button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
									</div>
							</form>
							<div class="chax_conbox">
								<div class="chax_jiegbt clearfix">
									<div class="chax_jieg">鼓励金总额笔数：{$paylog->total()} ,
										充值总金额：{$fy.je},{if $Think.session.user_level==1}平台总分佣：{$fy.oemfy},{/if}
										{if $Think.session.user_level==1 || $Think.session.user_level==4}省级代理总分佣：{$fy.sd},{/if}
										{if $Think.session.user_level==1 || $Think.session.user_level==4 || $Think.session.user_level==2}市级代理总分佣：{$fy.sd},{/if}
										区域运营商总分佣：{$fy.sd2},
										市场专员分佣：{$fy['je']*0.05}，
										商家总分佣：{$fy.sj},
										员工总分佣：{$fy.yg},
										推荐人总分佣：{$fy.tj}</div>
									<div class="chax_xzbtnbox">
										<a href="#" onclick="check()"><i class="iconfont icon-daochu"></i>导出</a>
									</div>
								</div>
								<div class="chax_jiegnr">
									<table class="zizh_table1" >
										<thead>
											<tr>
												<th style="width:10%">订单号</th>
												<th style="width:8%">会员编号</th>
												<th style="width:8%">金额</th>
												{if $Think.session.user_level==1}
												<th style="width:5%">平台分佣</th>
												{/if}
												{if $Think.session.user_level==1 || $Think.session.user_level==4 }
												<th style="width:5%">省级代理商分佣</th>
												{/if}
												{if $Think.session.user_level==1 || $Think.session.user_level==4 || $Think.session.user_level==2}
												<th style="width:5%">市级代理商分佣</th>
												{/if}
												<th style="width:5%">区域运营商分佣</th>
												<th style="width:8%">市场专员分佣</th>
												<th style="width:8%">商家分佣</th>
												<!-- <th style="width:8%">市场专员id</th> -->
												<th style="width:8%"><!--员工id/-->员工分佣</th>
											
												<th style="width:8%">推荐人分佣</th>
												
												<th style="width:8%">日期</th>
											</tr>
										</thead>
										<tbody id="tbody">
											{volist name="paylog" id="vo" empty="$empty"}
											<tr>
												<td>{$vo.order_sn}</td>
												<td>{$vo.uid}</td>
												<td>
													<?php echo $vo['balance'] ?>
												</td>
												{if $Think.session.user_level==1}
												<td>{$vo['oem_commission']}</td>
												{/if} 
												{if $Think.session.user_level==1 || $Think.session.user_level==4 }
												<td>{$vo['agency_id_commission']}</td>
												{/if} 
												{if $Think.session.user_level==1 || $Think.session.user_level==4 || $Think.session.user_level==2}
												<td>{$vo['agency_id1_commission']}</td>
												{/if}
												<td>{$vo['agency_id2_commission']}</td>
												<td>{$vo.sc_commission}</td>
												<td>{$vo.tj_agent_commission}</td>
												<!-- <td>{$vo.salesman_id}</td> -->
												
												<td><!--{$vo.tj_clerk_id}/-->{if $vo.clerk_commission}{$vo.clerk_commission}{else /}0{/if}</td>
												<!--<td>
													<?php echo $vo['pt_commission']==0?'':$vo['pt_commission'] ?>
												</td>-->
												<td>{$vo.level1_commisssion}</td>
												<!--<td>
													<?php echo $vo['pt1_commission'] ?>
												</td>-->
												<td>{$vo.add_time}</td>
											</tr>
											{/volist}
										</tbody>
									</table>

									<div class="fenye" style="display: block;">
										<ul class="pagination">
											{$paylog->render()}
										</ul>
									</div>
								</div>
							</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}

	</body>

</html>
<script type="text/javascript">
	layui.use('laydate', function() {
		var laydate = layui.laydate;

		//日期控件
		laydate.render({
			elem: '#begin_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});

		laydate.render({
			elem: '#end_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});
	})

	function check() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		
		var pt1_id = $('#pt1_id').val();
		var ch_city = $('#ch_city').val();
		var agent_id = $('#agent_id').val();
		var operator = $('#operator').val();
		var uid = $('#uid').val();
		window.location.href = "/oem/count/buy_export.html?begin_time=" + begin_time + "&end_time=" + end_time+ "&pt1_id=" + pt1_id+ "&ch_city=" + ch_city+ "&agent_id=" + agent_id+ "&operator=" + operator+ "&uid=" + uid;
	}
</script>